<?php
namespace libs\qoy\Logger;
/**
 * Explorer 直接输出日记到控制台的日记类 
 * 
 * - 测试环境下使用
 * 
 */
class Explorer extends Logger {
        
	public function log($type, $msg, $data) {
            $msgArr = array();
            $msgArr[] = date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']);
            $msgArr[] = strtoupper($type);
            $msgArr[] = str_replace(PHP_EOL, '\n', $msg);
            if ($data !== NULL) {
                $msgArr[] = is_array($data) ? json_encode($data) : $data;
            }
            
            
            
//               $stdout = fopen('php://stdout', 'w');
//                fwrite($stdout,json_encode(array_merge($tmpArr,[$signature,$tmpStr]))."\n");   //为了打印出来的格式更加清晰，把所有数据都格式化成Json字符串
//                fclose($stdout);

            $content = implode('|', $msgArr) . PHP_EOL;

            echo "\n", $content, "\n";
	}
}
